Digital Wanderer

We live as long as we fly

Article - The current state of video compression, part 1

At first, I wanted to use Silverlight for videos on my blog, but hardly anyone has it installed. I don't yet suffer from an  inflated ego to such an extent to think that people would install some weird stuff on their computer just for my ancient, stupid clips. So I started looking at what's going on in the enemy camp, namely Adobe flash video. While at it, I also researched what's generally happening in the realm of digital multimedia encoding.

Primer and glossary

Codec – a program that uses specific encoding and decoding algorithms to compress  video. A codec is the implementation of a standard, meaning a document that defines what the result will be and how it should be played back. This is how compatibility is achieved: something compressed with DivX can be played by XviD, and vice versa. A codec consists of a coder and a decoder, hence the name.

Container – the file format in which the compressed video is stored.

The classic ancient container is AVI, Microsoft loves its ASF (ASF or WMV extension), flash – FLV, on DVD – IFO/VOB, the new container for everyone's beloved H.264 – MP4, Quick Time uses its own (with a MOV extension), anime fans use Matroska (.MKV), and well, basically it's all on Wikipedia

Most containers allow you to cram in video compressed with different codecs. The file extension can vary too, it doesn't really matter.

DirectX filter – a special program format for codecs that allows other programs (usually players) to use them. For example, to play MPEG4 video made with the DivX codec using ZoomPlayer, you can install the XviD filter, which includes an implementation of the MPEG4 codec. Or you can install the native DivX codec filter.

History and theory

On DVDs and in satellite broadcasts, if you recall, the ancient MPEG-2 codec is used. The MPEG consortium didn't stop working and spawned a legitimate heir, MPEG-4 Part 2 (usually just called MPEG-4), which spread in the form of its illegitimate brother DivX and the semi-legitimate bastard XviD. However, we don't care much about them now, because quite a while ago the pinnacle of progress emerged – the CPU-hungry H.264, also known as MPEG-4 Part 10. It is now everywhere: in phones, game consoles, and is also quite often supported by special hardware accelerators and even video cards like the ATI HD2600. H.264, naturally, compresses best of all at the same quality, or rather, the quality is higher for the same size.

Meanwhile, Microsoft hustled and created something similar – a continuation of the Windows Media endeavor (usually in a .wmv container) called VC-1. The differences from H.264 are – seemingly lower CPU requirements during decoding, and possibly – sometimes slightly better quality.

Both of these codecs are actively used not only by video pirates on trackers, as you might have thought, but also on high-definition Blu-ray and HD-DVD discs (the latter has already passed away).

But here is the sad part – until a certain time on the internet, which is where a high degree of compression would be most in demand, all sorts of murky ancient junk reigned supreme. And all because the main method of delivering video on the web was flash, and it only supported rather weak commercial codecs whose names will not go down in history.

On top of that, Adobe also used its own flv container for flash video, which didn't exactly bring joy to webmasters either – you had to not only transcode the video, but also repackage it.

Fortunately, Microsoft hustled and released Silverlight. It's actually good for a lot of things, but in this case we are interested in the fact that it supports the excellent VC-1 codec. Then again, it's the same old crap – the format is closed, proprietary, and on top of that it's in an ASF container. And most importantly – hardly anyone had Silverlight installed on their computer, so for webmasters craving quality, this isn't a way out either.

Part two, the practical one.